<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: BlankSlate</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">BlankSlate</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../files/vendor/rails/activesupport/lib/active_support/vendor/builder-2_1_2/blankslate_rb.html">
                vendor/rails/activesupport/lib/active_support/vendor/builder-2.1.2/blankslate.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                <a href="Object.html">
                Object
               </a>
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
<a href="BlankSlate.html">BlankSlate</a> provides an abstract base class
with no predefined methods (except for <tt>__send__</tt> and
<tt>__id__</tt>). <a href="BlankSlate.html">BlankSlate</a> is useful as a
base class when writing classes that depend upon <tt>method_missing</tt>
(e.g. dynamic proxies).
</p>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000129">find_hidden_method</a>&nbsp;&nbsp;
      <a href="#M000128">hide</a>&nbsp;&nbsp;
      <a href="#M000130">reveal</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000129" class="method-detail">
        <a name="M000129"></a>

        <div class="method-heading">
          <a href="#M000129" class="method-signature">
          <span class="method-name">find_hidden_method</span><span class="method-args">(name)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000129-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000129-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/vendor/builder-2.1.2/blankslate.rb, line 31</span>
31:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">find_hidden_method</span>(<span class="ruby-identifier">name</span>)
32:       <span class="ruby-ivar">@hidden_methods</span> <span class="ruby-operator">||=</span> {}
33:       <span class="ruby-ivar">@hidden_methods</span>[<span class="ruby-identifier">name</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">superclass</span>.<span class="ruby-identifier">find_hidden_method</span>(<span class="ruby-identifier">name</span>)
34:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000128" class="method-detail">
        <a name="M000128"></a>

        <div class="method-heading">
          <a href="#M000128" class="method-signature">
          <span class="method-name">hide</span><span class="method-args">(name)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Hide the method named <tt>name</tt> in the <a
href="BlankSlate.html">BlankSlate</a> class. Don&#8216;t <a
href="BlankSlate.html#M000128">hide</a> <tt>instance_eval</tt> or any
method beginning with &quot;__&quot;.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000128-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000128-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/vendor/builder-2.1.2/blankslate.rb, line 22</span>
22:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">hide</span>(<span class="ruby-identifier">name</span>)
23:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">instance_methods</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>) <span class="ruby-keyword kw">and</span>
24:         <span class="ruby-identifier">name</span> <span class="ruby-operator">!~</span> <span class="ruby-regexp re">/^(__|instance_eval)/</span>
25:         <span class="ruby-ivar">@hidden_methods</span> <span class="ruby-operator">||=</span> {}
26:         <span class="ruby-ivar">@hidden_methods</span>[<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_sym</span>] = <span class="ruby-identifier">instance_method</span>(<span class="ruby-identifier">name</span>)
27:         <span class="ruby-identifier">undef_method</span> <span class="ruby-identifier">name</span>
28:       <span class="ruby-keyword kw">end</span>
29:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000130" class="method-detail">
        <a name="M000130"></a>

        <div class="method-heading">
          <a href="#M000130" class="method-signature">
          <span class="method-name">reveal</span><span class="method-args">(name)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Redefine a previously hidden method so that it may be called on a blank
slate object.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000130-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000130-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/vendor/builder-2.1.2/blankslate.rb, line 38</span>
38:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reveal</span>(<span class="ruby-identifier">name</span>)
39:       <span class="ruby-identifier">bound_method</span> = <span class="ruby-keyword kw">nil</span>
40:       <span class="ruby-identifier">unbound_method</span> = <span class="ruby-identifier">find_hidden_method</span>(<span class="ruby-identifier">name</span>)
41:       <span class="ruby-identifier">fail</span> <span class="ruby-node">&quot;Don't know how to reveal method '#{name}'&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">unbound_method</span>
42:       <span class="ruby-identifier">define_method</span>(<span class="ruby-identifier">name</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-operator">*</span><span class="ruby-identifier">args</span><span class="ruby-operator">|</span>
43:         <span class="ruby-identifier">bound_method</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">unbound_method</span>.<span class="ruby-identifier">bind</span>(<span class="ruby-keyword kw">self</span>)
44:         <span class="ruby-identifier">bound_method</span>.<span class="ruby-identifier">call</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
45:       <span class="ruby-keyword kw">end</span>
46:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>